#!/bin/bash

# ----------------------------------------------------------------------
# Filename:   75554-java.sh
# Version:    1.0
# Date:       2013/12/02
# Author:     yuanhui.shi
# Email:      yuanhui.shi@cs2c.com.cn
# Summary:    02系统基本功能-07开发环境-01语言支持-05JAVA语言
# Notes:      JAVA语言
# Copyright:  China Standard Software Co., Ltd.
# History：     
#             Version 1.0, 2013/12/02
#             -   The first one
# ----------------------------------------------------------------------

PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH

source ../../lib/Echo.sh

source ../../lib/XmlParse.sh


function CleanData ()
{
  rm -rf hello.java
  rm -rf hello.class
  EchoInfo "75554-java.sh执行完毕"
}

trap "CleanData" EXIT INT

#执行java文件
echo "class hello" >hello.java
echo -e "{\npublic static void main(String[] agrs){" >>hello.java
echo -e 'System.out.println("Hello World!");' >>hello.java
echo -e "}\n}" >>hello.java
cat hello.java

javac hello.java
EchoResult "编译.java文件成功"
[ "`java hello`" == "Hello World!" ]
EchoResult "执行.java文件成功"

